<?php 
$username = $this->session->userdata('username');
$password = $this->session->userdata('password');
if (empty($username) AND empty($password)){
	echo"..";
}else{
?>
<div id="wrappercontent">
	<div align="right">
		<a href="#userscreate" role="button" class="btn btn-danger" data-toggle="modal">Create</a>
	</div>
	<div id="demo" style="margin-top:20px;">
	<table cellpadding="0" cellspacing="0" border="0" class="table" id="example" style="font-size:12px; margin-bottom:20px;">
		<thead>
			<tr>
				<th>No</th>
				<th>Name</th>
				<th>Username</th>
				<th>Email</th>
				<th>No. Telp</th>
				<th>Level</th>
				<th></th>
			</tr>
		</thead>
		
		<tbody>
		<?php $i = 1 ?>
		<?php foreach($users as $data): ?>
		<tr>
			<td><?php echo $i++ ?></td>
			<td><?php echo $data->nama_lengkap ?></td>
			<td><?php echo $data->username ?></td>
			<td><?php echo $data->email ?></td>
			<td><?php echo $data->no_telp ?></td>
			<td>
			<?php 
			if($data->level=='1'){
				echo"Administrator";
			}else{
				echo"User";
			}
			?>
			</td>
			<td>
			<div align="center">
				<?php echo anchor("login/form_update_users/$data->id_user", '<i class=icon-edit></i>'); ?> | 
				<?php echo anchor("login/delete_users/$data->id_user", '<i class=icon-trash></i>'); ?>
			</div>
			</td>
		</tr>
		<?php endforeach ?>
		</tbody>
	</table>
	</div>
</div>


<div id="userscreate" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top:100px;">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<div style="font-size:19px;">Create</div>
	</div>
	<div class="modal-body">
		<div class="row-fluid">
			<?php echo form_open('login/create_users');?>
				<div class="span6">
					Name
					<p style="margin-top:5px;"><input type="text" name="nama_lengkap"></p>
					Username
					<p style="margin-top:5px;"><input type="text" name="username"></p>
					Password
					<p style="margin-top:5px;"><input type="text" name="password"></p>
				</div>
				<div class="span6">
					Email
					<p style="margin-top:5px;"><input type="text" name="email"></p>
					No. Telp
					<p style="margin-top:5px;"><input type="text" name="no_telp"></p>
					Level
					<p>
						<label class="radio" style="float:left; margin-top:10px;">
							<input type="radio" name="level" id="level" value="1" checked>
							Adminstrator
						</label>
						<label class="radio" style="float:left; margin-left:10px; margin-top:10px;">
							<input type="radio" name="level" id="level" value="1">
							User
						</label>
					</p>
				</div>
			
		</div>
	</div>
	<div class="modal-footer">
		<input type="submit" value="save" class="btn btn-danger">
	</div>
	<?php echo form_close(); ?>
</div>
<?php
}
?>